<div class="ibox-content">
<form class="form-horizontal" id="f_add" method="post" >
   <div class="form-group" >
		<label class="col-sm-3 control-label" for="name"></label>
		<div class="col-sm-6"> 
        <h4> 添加新的产品分类</h4> 
		</div>
	</div>
	<div class="form-group" >
		<label class="col-sm-3 control-label" for="name">分类名称：</label>
		<div class="col-sm-6"> 
          <span class="require">*</span><input  type="text" name="name" id="name" />
		</div>
	</div>

<div class="form-group" >
		<label class="col-sm-3 control-label" for="name">排序：</label>
		<div class="col-sm-6"> 
          <input class="span3" type="text" name="descno" id="descno" placeholder="排序" size="5" value="100">
		</div>
	</div>

	<div class="form-group">
		<label class="col-sm-3 control-label" for="name"></label>
		<div class="col-sm-8">
			
			<input class="btn btn-primary" id="btn_save" type="submit" name="submit" value="新增"/> &nbsp; 
			<input class="btn" onclick="javascript:layer.closeAll();"  type="button" value="取消"/>
		</div>
	</div>
</form>
</div>

 <script>


function showResponse(responseText,statusText) {
  if(statusText=='success'){
	  console.log(responseText);
	if (responseText.status == 1) {
		parent.layer.msg(responseText.info, {icon: 1}); //正确的图标提示
		$(".form-control").val("");
		$("#refresh_data_table").trigger("click");
		//parent.layer.closeAll();
	} else {
		parent.layer.msg(responseText.info, {icon: 2}); //错误的图标提示
	}
	
  }
}


$(function(){
	
	$.validator.setDefaults({
		highlight: function (element) {
			$(element).closest('.form-group').removeClass('has-success').addClass('has-error');
		},
		success: function (element) {
			element.closest('.form-group').removeClass('has-error').addClass('has-success');
		},
		errorElement: "span",
		errorPlacement: function (error, element) {
			if (element.is(":radio") || element.is(":checkbox")) {
				error.appendTo(element.parent().parent().parent());
			} else {
				error.appendTo(element.parent());
			}
		},
		errorClass: "help-block m-b-none",
		validClass: "help-block m-b-none"


	});
	
	

   $("#f_add").validate({
        submitHandler:function(form){
			var param = $("#f_add").serialize();  
			var url = '__APP__/index.php/ProCate/add/';
			//console.log(url);
			//console.log(param);
	  		ajax_do(url,param);	
			
        }    
    });

	$(".fa-gift").parent().parent().addClass("active");
	$(".fa-table").parent().parent().addClass("active");
});

</script>
